package test.com.sky.designPattern.statePattern;


import com.sky.JULLog.MyLogger;

import java.util.logging.Logger;

/**
 * 开门状态 ,
 */
public class OpeningState extends LiftState {


    private Logger log = MyLogger.getLogger(OpeningState.class);


    OpeningState(Lift lift) {
        super(lift);
    }


    @Override
    public void open() {
       log.severe("开门状态不能执行开门动作!!!");
    }

    @Override
    public void close() {
        // 执行关门动作
        // 1、转化为关门状态
        lift.setState(lift.getClosingState());
        // 2、关门
        lift.close();
    }

    @Override
    public void run() {
        // throw exception
        log.severe("开门状态，不能执行运行动作");

    }

    @Override
    public void stop() {
        // throw exception
        log.severe("开门状态下，不执行停止动作");

    }
}

